package com.onpositive.units;

import java.util.Map;

import com.onpositive.semantic.model.api.meta.IMeta;
import com.onpositive.semantic.model.api.property.IPropertyProvider;


public abstract class AbstractValueParser {
	
	public AbstractValueParser( String id ){
		this.id = id ;
	}
	
	private final String id ;
	
 
	public abstract ParsedValue parse(
										String s,
										IMeta meta,
										IPropertyProvider propertyProvider,
										Map<String,Object> metaInfo,
										String comment );
	
	public String getId(){ return id ; }

	
	protected String getDefaultComment( String comment ){
		final String className = this.getClass().getSimpleName();
		
		if( comment == null )
			return className ;
		
		StringBuilder bld = new StringBuilder( comment ) ;
		bld.append("(") ;
		bld.append( className ) ;
		bld.append(")") ;
		final String result = bld.toString();
		return result ;
	}
}
